import request from "@utils/http/request"
import {
    getHospitalSetListParamsType,
    getHospitalSetListRequestType,
    addHospitalParamType,
    getHospitalSetListRecordsItemType,
    updateHospitalSetByIdType
} from "./model/hospitalSetType"
import { Key } from "react"



//医院设置获取数据发送请求
export const getHospitalSetListRequire = ({ page, limit, hosname, hoscode }: getHospitalSetListParamsType) => {
    // console.log(hosname);

    return request.get<any, getHospitalSetListRequestType>(`/admin/hosp/hospitalSet//${page}/${limit}`, {
        params: {
            hosname,
            hoscode
        }
    })
}


// 医院设置，添加医院发送请求
export const addHospitalRequest = (data: addHospitalParamType) => {
    return request.post<any, null>("/admin/hosp/hospitalSet/save", data)
}

//根据获取到的医院id  来请求医院的详细信息
export const getHospitalSetByIdRequest = (id: string) => {
    return request.get<any, getHospitalSetListRecordsItemType>(`/admin/hosp/hospitalSet/get/${id}`)
}

//根据通过id获取到的医院的详细信息进行修改后提交
export const updateHospitalSetByIdRequest = (data: updateHospitalSetByIdType) => {
    return request.put<any, null>("/admin/hosp/hospitalSet/update", data)
}

//根据id删除数据
export const deleteHospitalSetByIdRequest = (id: number) => {
    return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

//医院设置，批量删除
export const batchDeleteHospitalRequest = (ids: Key[]) => {    
    return request.delete<any,null>("/admin/hosp/hospitalSet/batchRemove", {
        data: ids
    })
}
